package cn.alm.springmvcrestfulcrud.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
@Schema(description = "员工添加数据对象")
public class EmployeeAddVo {

//    private Integer id;

    @NotBlank(message = "姓名不能为空")
    @Schema(description = "姓名", example = "alm")
    private String name;

    @NotNull(message = "年龄不能为空")
    @Max(value = 120, message = "年龄不能大于120")
    @Min(value = 0, message = "年龄不能小于0")
    @Schema(description = "年龄", example = "18")
    private Integer age;

    @Email(message = "邮箱格式不正确")
    @Schema(description = "邮箱", example = "alm@163.com")
    private String email;

    // 性别只能为：男、女
    @Pattern(regexp = "^(男|女)$", message = "性别只能为：男、女")
    @Schema(description = "性别", example = "男")
    private String gender;

    @Schema(description = "地址", example = "中国")
    private String address;

    @Schema(description = "薪资", example = "10000.00")
    private BigDecimal salary;

    @Schema(description = "生日", example = "2023-01-01 10:30:30")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date birthday;
}
